package com.whm.hrmanagement.service.impl;

import java.util.List;
import com.whm.common.utils.DateUtils;
import com.whm.system.mapper.SysDeptMapper;
import com.whm.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.whm.hrmanagement.mapper.OaPersonAskMapper;
import com.whm.hrmanagement.domain.OaPersonAsk;
import com.whm.hrmanagement.service.IOaPersonAskService;

/**
 * 招聘管理-招聘需求Service业务层处理
 * 
 * @author whm
 * @date 2024-02-04
 */
@Service
public class OaPersonAskServiceImpl implements IOaPersonAskService 
{
    @Autowired
    private OaPersonAskMapper oaPersonAskMapper;
    @Autowired
    private SysUserMapper sysUserMapper;

    @Autowired
    private SysDeptMapper sysDeptMapper;
    /**
     * 查询招聘管理-招聘需求
     * 
     * @param id 招聘管理-招聘需求主键
     * @return 招聘管理-招聘需求
     */
    @Override
    public OaPersonAsk selectOaPersonAskById(Long id)
    {
        return oaPersonAskMapper.selectOaPersonAskById(id);
    }

    /**
     * 查询招聘管理-招聘需求列表
     * 
     * @param oaPersonAsk 招聘管理-招聘需求
     * @return 招聘管理-招聘需求
     */
    @Override
    public List<OaPersonAsk> selectOaPersonAskList(OaPersonAsk oaPersonAsk)
    {
        return oaPersonAskMapper.selectOaPersonAskList(oaPersonAsk);
    }

    /**
     * 新增招聘管理-招聘需求
     * 
     * @param oaPersonAsk 招聘管理-招聘需求
     * @return 结果
     */
    @Override
    public int insertOaPersonAsk(OaPersonAsk oaPersonAsk)
    {
        oaPersonAsk.setCreateTime(DateUtils.getNowDate());
        oaPersonAsk.setShenqingrenTxt(sysUserMapper.getNameById(oaPersonAsk.getShenqingren()));
        oaPersonAsk.setDepartName(sysDeptMapper.getDeptNameById(oaPersonAsk.getDepartId()));



        return oaPersonAskMapper.insertOaPersonAsk(oaPersonAsk);
    }

    /**
     * 修改招聘管理-招聘需求
     * 
     * @param oaPersonAsk 招聘管理-招聘需求
     * @return 结果
     */
    @Override
    public int updateOaPersonAsk(OaPersonAsk oaPersonAsk)
    {
        oaPersonAsk.setUpdateTime(DateUtils.getNowDate());
        oaPersonAsk.setShenqingrenTxt(sysUserMapper.getNameById(oaPersonAsk.getShenqingren()));
        oaPersonAsk.setDepartName(sysDeptMapper.getDeptNameById(oaPersonAsk.getDepartId()));
        return oaPersonAskMapper.updateOaPersonAsk(oaPersonAsk);
    }

    /**
     * 批量删除招聘管理-招聘需求
     * 
     * @param ids 需要删除的招聘管理-招聘需求主键
     * @return 结果
     */
    @Override
    public int deleteOaPersonAskByIds(Long[] ids)
    {
        return oaPersonAskMapper.deleteOaPersonAskByIds(ids);
    }

    /**
     * 删除招聘管理-招聘需求信息
     * 
     * @param id 招聘管理-招聘需求主键
     * @return 结果
     */
    @Override
    public int deleteOaPersonAskById(Long id)
    {
        return oaPersonAskMapper.deleteOaPersonAskById(id);
    }
}
